Promotional Transformation of Monadic Programs
نویسندگان
چکیده
Monads are becoming an increasingly important tool for structural functional programming, because they provide a uniform framework for describing a wide range of programming language features. To facilitate program transformation, Fokkinga derived a su cient assumption under which there is a kind of socalled monadic catamorphisms which satisfy several general laws useful for the transformation of monadic programs. However, his theory is too restrictive to be applied. In this paper, we propose a new theory on monadic catamorphism by moving Fokkinga's assumption on the monad to the condition on a map between monadic algebras so that our theory is valid for arbitrary monads including, for example, the state monad that is not allowed in Fokkinga's theory. Our theory covers Fokkinga's as a special case but can be applied to a wider class of monadic programs. Many examples will be used to illustrate our idea.
منابع مشابه
Promotional Transformation on Monadic Programs
Monads, proposed by Moggi [16] of their use in structuring denotational descriptions and then popularized by Wadler[21], are becoming an increasingly important tool for structural functional programming[8, 10, 11]. The reason is that monads provide a uniform framework for describing a wide range of programming language features including, for example, state, I/O, continuations, exceptions, pars...
متن کاملOn Optimization of Monadic Logic Programs
The article is devoted to the optimization of monadic logic programs and goals (programs and goals, which do not use functional symbols of arity > 1 and use only predicate symbols of arity 1). A program P is terminating with respect to a goal G, if an SLD-tree of P and G is finite. In general, monadic programs are not terminating. Program and goal transformations are introduced, by which a mona...
متن کاملMonadification of functional programs
The structure of monadic functional programs allows the integration of many different features by just changing the definition of the monad and not the rest of the program, which is a desirable feature from a software engineering and software maintenance point of view. We describe an algorithm for the automatic transformation of a group of functions into such a monadic form. We identify two cor...
متن کاملTransforming Functional Logic Programs into Monadic Functional Programs
We present a high-level transformation scheme to translate lazy functional logic programs into pure Haskell programs. This transformation is based on a recent proposal to efficiently implement lazy non-deterministic computations in Haskell in a monadic style. We build on this work and define a systematic method to transform lazy functional logic programs into monadic programs with explicit shar...
متن کاملCombining Logic Programs and Monadic Second Order Logics by Program Transformation
We present a program synthesis method based on unfold/fold transformation rules which can be used for deriving terminating definite logic programs from formulas of the Weak Monadic Second Order theory of one successor (WS1S). This synthesis method can also be used as a proof method which is a decision procedure for closed formulas of WS1S. We apply our synthesis method for translating CLP(WS1S)...
متن کامل